package com.hzya.frame.system.module.entity;
import com.hzya.frame.system.dictionaryshop.entity.DictionaryShopEntity;
import com.hzya.frame.system.user.entity.UserEntity;
import com.hzya.frame.utils.core.annotation.Dictionary;
import com.hzya.frame.utils.core.entity.BaseEntity;

import java.util.HashMap;

/**
 * @description: 模块  
 * @tableName:   system_module 
 * @entityName:  ModuleEntity
 * @author: 	 gjh
 * @history:	 1.0
 */
public class  ModuleEntity extends BaseEntity implements Comparable<ModuleEntity> {
	/** controller地址 */
	private String controlle_address;
	/** 等级 */
	private String lvl;
	/** 名称 */
	private String name;
	/** 类型 */
	private String type;
	/** 模块操作级别Superadministrator */
	private String level;
	/** 操作级别映射*/
	@Dictionary(tab_name = "system_module", column_name = "level")
	private DictionaryShopEntity levelEntity;
	/** 模块图标 */
	private String icon;
	/** 上级id */
	private Long up_id;
	/** 上级模块名称，连接查询*/
	private String up_name;
	/** 链接地址 */
	private String url;
	/** 是否关键模块(Y是N否) */
	private String key_modular;
	/** 跳转目标 */
	private String target;
	/** url规则 */
	private String url_pattern;
	/** html内容 */
	private String htm_content;
	/** 排序编号 */
	private Long order_num;
	/** 备注 */
	private String remark;
	/** 延迟加载创建人*/
	private UserEntity createUserEntity;
	/** controller地址 */
	public void setControlle_address(String controlle_address) {
		this.controlle_address = controlle_address;
	}
	/** controller地址 */
	public String getControlle_address() {
		return controlle_address;
	}
	/** 等级 */
	public void setLvl(String lvl) {
		this.lvl = lvl;
	}
	/** 等级 */
	public String getLvl() {
		return lvl;
	}
	/** 名称 */
	public void setName(String name) {
		this.name = name;
	}
	/** 名称 */
	public String getName() {
		return name;
	}
	/** 类型 */
	public void setType(String type) {
		this.type = type;
	}
	/** 类型 */
	public String getType() {
		return type;
	}
	/** 模块操作级别Superadministrator */
	public void setLevel(String level) {
		this.level = level;
	}
	/** 模块操作级别Superadministrator */
	public String getLevel() {
		return level;
	}
	/** 模块图标 */
	public void setIcon(String icon) {
		this.icon = icon;
	}
	/** 模块图标 */
	public String getIcon() {
		return icon;
	}
	/** 上级id */
	public void setUp_id(Long up_id) {
		this.up_id = up_id;
	}
	/** 上级id */
	public Long getUp_id() {
		return up_id;
	}

	public String getUp_name() {
		return up_name;
	}

	public void setUp_name(String up_name) {
		this.up_name = up_name;
	}

	public DictionaryShopEntity getLevelEntity() {
		return levelEntity;
	}

	public void setLevelEntity(DictionaryShopEntity levelEntity) {
		this.levelEntity = levelEntity;
	}

	public UserEntity getCreateUserEntity() {
		return createUserEntity;
	}

	public void setCreateUserEntity(UserEntity createUserEntity) {
		this.createUserEntity = createUserEntity;
	}

	/** 链接地址 */
	public void setUrl(String url) {
		this.url = url;
	}
	/** 链接地址 */
	public String getUrl() {
		return url;
	}

	public String getKey_modular() {
		return key_modular;
	}

	public void setKey_modular(String key_modular) {
		this.key_modular = key_modular;
	}

	/** 跳转目标 */
	public void setTarget(String target) {
		this.target = target;
	}
	/** 跳转目标 */
	public String getTarget() {
		return target;
	}
	/** url规则 */
	public void setUrl_pattern(String url_pattern) {
		this.url_pattern = url_pattern;
	}
	/** url规则 */
	public String getUrl_pattern() {
		return url_pattern;
	}
	/** html内容 */
	public void setHtm_content(String htm_content) {
		this.htm_content = htm_content;
	}
	/** html内容 */
	public String getHtm_content() {
		return htm_content;
	}
	/** 排序编号 */
	public void setOrder_num(Long order_num) {
		this.order_num = order_num;
	}
	/** 排序编号 */
	public Long getOrder_num() {
		return order_num;
	}
	/** 备注 */
	public void setRemark(String remark) {
		this.remark = remark;
	}
	/** 备注 */
	public String getRemark() {
		return remark;
	}

	public boolean equals(Object o) {
		ModuleEntity moduleEntity = (ModuleEntity) o;
		boolean flag = false;
		if (null != this && null != this.getId() && null != moduleEntity && null != moduleEntity.getId()) {
			flag = this.getId().equals(moduleEntity.getId());
		}
		return flag;
	}

	/**
	 * Returns a hash code value for the object. This method is
	 * supported for the benefit of hash tables such as those provided by
	 * {@link HashMap}.
	 * <p>
	 * The general contract of {@code hashCode} is:
	 * <ul>
	 * <li>Whenever it is invoked on the same object more than once during
	 * an execution of a Java application, the {@code hashCode} method
	 * must consistently return the same integer, provided no information
	 * used in {@code equals} comparisons on the object is modified.
	 * This integer need not remain consistent from one execution of an
	 * application to another execution of the same application.
	 * <li>If two objects are equal according to the {@code equals(Object)}
	 * method, then calling the {@code hashCode} method on each of
	 * the two objects must produce the same integer result.
	 * <li>It is <em>not</em> required that if two objects are unequal
	 * according to the {@link Object#equals(Object)}
	 * method, then calling the {@code hashCode} method on each of the
	 * two objects must produce distinct integer results.  However, the
	 * programmer should be aware that producing distinct integer results
	 * for unequal objects may improve the performance of hash tables.
	 * </ul>
	 * <p>
	 * As much as is reasonably practical, the hashCode method defined by
	 * class {@code Object} does return distinct integers for distinct
	 * objects. (This is typically implemented by converting the internal
	 * address of the object into an integer, but this implementation
	 * technique is not required by the
	 * Java&trade; programming language.)
	 *
	 * @return a hash code value for this object.
	 * @see Object#equals(Object)
	 * @see System#identityHashCode
	 */
	@Override
	public int hashCode() {
		return super.hashCode();
	}

	/**
	 * Compares this object with the specified object for order.  Returns a
	 * negative integer, zero, or a positive integer as this object is less
	 * than, equal to, or greater than the specified object.
	 * <p>
	 * <p>The implementor must ensure <tt>sgn(x.compareTo(y)) ==
	 * -sgn(y.compareTo(x))</tt> for all <tt>x</tt> and <tt>y</tt>.  (This
	 * implies that <tt>x.compareTo(y)</tt> must throw an exception iff
	 * <tt>y.compareTo(x)</tt> throws an exception.)
	 * <p>
	 * <p>The implementor must also ensure that the relation is transitive:
	 * <tt>(x.compareTo(y)&gt;0 &amp;&amp; y.compareTo(z)&gt;0)</tt> implies
	 * <tt>x.compareTo(z)&gt;0</tt>.
	 * <p>
	 * <p>Finally, the implementor must ensure that <tt>x.compareTo(y)==0</tt>
	 * implies that <tt>sgn(x.compareTo(z)) == sgn(y.compareTo(z))</tt>, for
	 * all <tt>z</tt>.
	 * <p>
	 * <p>It is strongly recommended, but <i>not</i> strictly required that
	 * <tt>(x.compareTo(y)==0) == (x.equals(y))</tt>.  Generally speaking, any
	 * class that implements the <tt>Comparable</tt> interface and violates
	 * this condition should clearly indicate this fact.  The recommended
	 * language is "Note: this class has a natural ordering that is
	 * inconsistent with equals."
	 * <p>
	 * <p>In the foregoing description, the notation
	 * <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical
	 * <i>signum</i> function, which is defined to return one of <tt>-1</tt>,
	 * <tt>0</tt>, or <tt>1</tt> according to whether the value of
	 * <i>expression</i> is negative, zero or positive.
	 *
	 * @param o the object to be compared.
	 * @return a negative integer, zero, or a positive integer as this object
	 * is less than, equal to, or greater than the specified object.
	 * @throws NullPointerException if the specified object is null
	 * @throws ClassCastException   if the specified object's type prevents it
	 *                              from being compared to this object.
	 */
	@Override
	public int compareTo(ModuleEntity o) {
		return o.getOrder_num().compareTo(this.getOrder_num());
	}
}
